<script>
	export default {
		onLaunch: function() {
			// console.warn('当前组件仅支持 uni_modules 目录结构 ，请升级 HBuilderX 到 3.1.0 版本以上！')
			console.log('App Launch')
		},
		onShow: function() {
			console.log('App Show')
			// #ifdef APP-PLUS
			this.getWgt(uni.getStorageSync("baseUrl"))
			// #endif
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			async getWgt(url) {
				let local = ""
				let online = ""
				await plus.runtime.getProperty(plus.runtime.appid, (res) => {
					console.log(res.version, "@@@@@@@@本地版本号")
					local = Number(res.version.split(".").join(''))
				});
				await uni.request({
					url: url + "/api/index/get_setting",
					method: "POST",
					success: (res) => {
						console.log(res.data.data, "@@@@@@@@@@@")
						online = Number(res.data.data.version.split(".").join(''))
						console.log(local, "@@@本地", online, "@@@线上")
						if (local >= online) {
							console.log("<<<<<<<<<<<最新版本")
							uni.setStorageSync("update", false)
							return
						} else {
							uni.setStorageSync("update", true)
							uni.setStorageSync("wgtUrl", res.data.data.app_hot_update)
							console.log("<<<<<<<<<<<需要热更新")
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import '@/static/font/iconfont.css';
	@import '@/static/style/layout.scss';
	@import '@/static/style/common.scss';
	@import '@/uni_modules/uni-scss/index.scss';
	@import '@/uni_modules/uview-ui/index.scss';

	@font-face {
		font-family: PingFangSC;
		src: url('./static/font/pf.ttf');
	}

	uni-view,
	uni-text {
		box-sizing: border-box;
		font-family: PingFangSC;
	}

	// 设置整个项目的背景色
	page {
		background-color: #f5f5f5;
	}

	/deep/.uni-tabbar {
		box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(39, 85, 21, 0.18);
	}

	/deep/.uni-tabbar-bottom {
		z-index: 998 !important;
	}
</style>